package com.tonicgb.shared.scheduler;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

/**
 * @author zhaiyujin
 * @date 2021-09-07 14:27:26
 * @说明 测试定时任务
 */
@Component
@Configuration
//@EnableScheduling //开启定时任务
public class TestScheduler {
    //日志
    private static final Logger logger = LoggerFactory.getLogger(TestScheduler.class);


    //@Scheduled(fixedDelay = 1000 * 60L) //1分钟同步一次数据
    //@Scheduled(fixedDelay = 1000 * 5L) //5秒同步一次数据
    //@Scheduled(fixedDelay = 1000L * 60 * 60 * 24) //1天同步一次数据
    @Scheduled(fixedDelay = 1000 * 5L) //5秒同步一次数据
    public void init(){
//        logger.info("---OrderRefundByUser task------produce Data with fixed rate task: Execution Time - {}", DateUtil.nowDateTime());
        try {
            logger.info("fuck you"+ LocalDateTime.now());

        }catch (Exception e){
            e.printStackTrace();
            logger.error("TestScheduler.task" + " | msg : " + e.getMessage());
        }

    }


}
